#include "RemoteControl.h"
#include "Timer.h"
#include "CRC.h"
#include "Communication.h"

Timer* t;

void setup (){
  
  Serial.begin(9600);
  Serial1.begin(9600);
  
  SwitchRailData* switchRailData11 = new SwitchRailData(0x01, 31, 53);
  TrainData* trainData1 = new TrainData(0x01, A0, 39, 13);

  RemoteControlData remoteControlData = {switchRailData11, trainData1};

  RemoteControl* rC = new RemoteControl(remoteControlData);
  
  t = Timer::getTimer();
  
}

void loop(){
  t->update();
}



/**
* \brief Called when a dta is detected on serial port #1
* \param none
* \return none
*/
void serialEvent1()
{
  while (Serial1.available())
  {
    Communication::byteReceived(&Serial1, Serial1.read());
  }
}
